package com.ruoyi.framework.interceptor.impl;

import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import org.springframework.stereotype.Component;

import java.util.Random;

@Component
public class CustomIdGenerator implements IdentifierGenerator {
    @Override
    public Long nextId(Object entity) {
        // 生成10位长度的长整型ID
        return generateId();
    }

    private long generateId() {
        Random random = new Random();
        return 1_000_000_000L + random.nextInt(900_000_000);
    }
}
